package com.qf.smartplatform.mapper;


import com.qf.smartplatform.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

/**
 * projectName:day12_27_Test
 * author:guoLei
 * time:2021/12/28 20:26
 * description:
 */
public interface RoleMapper {
    @Select("SELECT * FROM sys_role WHERE role_id =#{role_id} ")
    Role selectRoleById(Long id);

    @Select("SELECT * FROM sys_role")
    List<Role> selectAllRoles();

    @Select("SELECT role_id FROM sys_user_role WHERE user_id =#{userId}")
    List<Long> selectRoleIdByUserId(Long userId);

    @Select("SELECT menu_id FROM sys_role_menu WHERE role_id =#{roleId}")
    List<Long> selectMenuIdByRoleId(Long roleId);

    @Delete("UPDATE sys_role set status=0 WHERE role_id=#{roleid}}")
    int deleteRoleById(@Param("roleid") List<Long> roleid);
}
